package com.web.util;

import java.util.ArrayList;
import java.util.List;

import wfm.entities.Address;
import wfm.entities.Partner;

public class Partners {
	
	private static List<Partner> partners = new ArrayList<Partner>();
	private static List<Partner> moldDamagePartners = new ArrayList<Partner>();
	private static List<Partner> waterDamagePartners = new ArrayList<Partner>();
	private static List<Partner> fireDamagePartners = new ArrayList<Partner>();
	private static List<Partner> gasDefectPartners = new ArrayList<Partner>();
	private static List<Partner> electroDefectPartners = new ArrayList<Partner>();
	
	static{
		moldDamagePartners.add(new Partner("Mold Specialists",new Address("Lovely Street 1", "Wien", "1050", "Österreich"), "066440789", "msp@mold.com"));
		moldDamagePartners.add(new Partner("Mold Meister",new Address("Down Street 1", "Wien", "1050", "Österreich"), "5678239", "msp@meister.com"));
		moldDamagePartners.add(new Partner("Mold AWAY",new Address("Fleet Street 1", "Wien", "1050", "Österreich"), "056782822", "away@mold.co.uk"));
		
		waterDamagePartners.add(new Partner("Plumber School",new Address("Lovely Street 1", "Wien", "1050", "Österreich"), "066440789", "msp@plumber.com"));
		waterDamagePartners.add(new Partner("Water Helper",new Address("Down Street 1", "Wien", "1050", "Österreich"), "5678239", "msp@helper.com"));
		waterDamagePartners.add(new Partner("Watery",new Address("Fleet Street 1", "Wien", "1050", "Österreich"), "056782822", "away@water.co.uk"));
		
		fireDamagePartners.add(new Partner("Fire Blaster",new Address("Lovely Street 1", "Wien", "1050", "Österreich"), "066440789", "msp@fire.com"));
		fireDamagePartners.add(new Partner("Danger Ranger",new Address("Down Street 1", "Wien", "1050", "Österreich"), "5678239", "msp@fire.com"));
		fireDamagePartners.add(new Partner("Fireman",new Address("Fleet Street 1", "Wien", "1050", "Österreich"), "056782822", "away@fire.co.uk"));
		
		gasDefectPartners.add(new Partner("GAS Blaster",new Address("Lovely Street 1", "Wien", "1050", "Österreich"), "066440789", "msp@gasbl.com"));
		gasDefectPartners.add(new Partner("GASYYY",new Address("Lovely Street ", "Wien", "1050", "Österreich"), "066440789", "msp@gasless.com"));
		gasDefectPartners.add(new Partner("GASLESS",new Address("Bloom Street 1", "Wien", "1050", "Österreich"), "23232323", "msp@gas.com"));
		
		electroDefectPartners.add(new Partner("Ede",new Address("Lovely Street 1", "Wien", "1050", "Österreich"), "066440789", "r.wallner@worker.com"));
		electroDefectPartners.add(new Partner("EDEFECT",new Address("Big Street 1", "Wien", "1050", "Österreich"), "066440789", "r.wallner@worker.com"));
		electroDefectPartners.add(new Partner("onlyE",new Address("Bloom Street 1", "Wien", "1050", "Österreich"), "066440789", "r.wallner@worker.com"));
		electroDefectPartners.add(new Partner("E-WAY",new Address("Low Street 1", "Wien", "1050", "Österreich"), "066440789", "r.wallner@worker.com"));
	}
	
	public static List<Partner> getPartners() {
		return partners;
	}
	
	public static List<Partner> getPartners(String typeOfDamage){
		
		int damage = Integer.parseInt(typeOfDamage);
		
		switch (damage) {
		case 1:
			setPartners(electroDefectPartners);
			break;
		case 2:
			setPartners(waterDamagePartners);
			break;
		case 3:
			setPartners(fireDamagePartners);
			break;
		case 4:
			setPartners(gasDefectPartners);
			break;
		case 5:
			setPartners(moldDamagePartners);
			break;
		}
		
		return partners; 
	}
	
	public static void setPartners(List<Partner> partners) {
		Partners.partners = partners;
	}
	
	public static Partner getPartnerByName(String name){
		for(Partner partner:partners){
			if(partner.getName().equals(name))
				return partner; 
		}
		
		return new Partner(); 
	}
	
}
